/*
 * LinkedList.h
 *
 *  Created on: 07.01.2013
 *      Author: phru
 */

#ifndef LINKEDLIST_H_
#define LINKEDLIST_H_

#include <stdio.h>
#include <stdlib.h>

typedef struct Node {
	uint32_t _value;
	struct Node* _pNext;
	struct Node* _pPrev;
} node_t;

typedef struct linkedList {
	/*member declaration*/
	node_t* _pFirstNode;
	node_t* _pLastNode;
	uint16_t _listSize;

	/*Method declaration*/
	void (*set)(struct linkedList* pList, uint32_t value);
	int (*get)(struct linkedList* pList, uint16_t index);
	void (*add)(struct linkedList* pList, uint32_t value);
	int (*isEmpty)(struct linkedList* pList);
	int (*size)(struct linkedList* pList);
	void (*printList)(struct linkedList* pList);
} linkedList_t;

/**
 * Create the linked list
 */
linkedList_t* createLinkedList();

/**
 * set the value at the position of a given node
 */
void set(linkedList_t* pList, uint32_t value);

/**
 * returns the value of the given index
 */
int get(linkedList_t* pList, uint16_t index);

void add(linkedList_t* pList, uint32_t value);

int isEmpty(linkedList_t* pList);

int size(linkedList_t* pList);

void printList(linkedList_t* pList);

node_t* createNode(uint32_t value);
#endif /* LINKEDLIST_H_ */
